package com.excell.template.example;


import com.excell.support.excellbasic.ColumnCell;
import com.excell.support.excellbasic.ExcellCellBasics;
import com.excell.support.excellbasic.ExcellSheetBasic;
import com.excell.support.excellbasic.RowCell;
import com.excell.template.GlobalTemplate;

/**
 * @User c.c
 * @Since 2022/12/16
 * @Time 16:40
 * @Description
 */

public class CustomerProject extends GlobalTemplate<String> {
  @Override
  public ExcellSheetBasic<String> setExcellTitle() {
    //初始化数据
    ExcellSheetBasic<String> workBook = super.initSheet("项目测试表");
//    HSSFCellStyle cellStyle = super.setStyly(workBook.getWorkbook().createCellStyle());
////    cellStyle.setWrapText(true);
//    HSSFCellStyle cellStyle2 = workBook.getWorkbook().createCellStyle();
//    HSSFCellStyle cellStyle3 = workBook.getWorkbook().createCellStyle();
//    cellStyle3.setBorderBottom(HSSFCellStyle.BORDER_THIN); //设置底线和颜色
//    cellStyle3.setBottomBorderColor(HSSFColor.BLACK.index);
//    cellStyle3.setBorderLeft(HSSFCellStyle.BORDER_THIN); //设置左边线和颜色
//    cellStyle3.setLeftBorderColor(HSSFColor.BLACK.index);
//    cellStyle3.setBorderRight(HSSFCellStyle.BORDER_THIN); //设置右边线和颜色
//    cellStyle3.setRightBorderColor(HSSFColor.BLACK.index);
//    cellStyle3.setBorderTop(HSSFCellStyle.BORDER_THIN); //设置上面线和颜色
//    cellStyle3.setTopBorderColor(HSSFColor.BLACK.index);
//    cellStyle3.setWrapText(true);
//
//    cellStyle3.setFillBackgroundColor(HSSFColor.RED.index);//添加背景色,内容看不清楚
//    cellStyle3.setFillPattern(HSSFCellStyle.BIG_SPOTS);
//    cellStyle3.setFillForegroundColor(HSSFColor.RED.index);//添加前景色,内容看的清楚
//    cellStyle3.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
////
//    cellStyle2.setFillBackgroundColor(HSSFColor.ORANGE.index);//添加背景色,内容看不清楚
//    cellStyle2.setFillPattern(HSSFCellStyle.BIG_SPOTS);
//    cellStyle2.setFillForegroundColor(HSSFColor.ORANGE.index);//添加前景色,内容看的清楚
//    cellStyle2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

//    HSSFFont front = super.setfront(workBook.getWorkbook().createFont());
//    cellStyle.setFont(front);
//    cellStyle3.setFont(front);

//    ExcellCellBasics<String> excellCellBasics = ExcellCellBasics.getInstance(cellStyle);
    ExcellCellBasics<String> excellCellBasics = ExcellCellBasics.getInstance();
    excellCellBasics.initTitle("月度业务明细", RowCell.intiRow(1), ColumnCell.intiColumn(1, 16))
      .initTitle("客户", RowCell.intiRow(2, 4), ColumnCell.intiColumn(1))
      .initTitle("12月发车", RowCell.intiRow(2, 4), ColumnCell.intiColumn(2))
      .initTitle("提前欠款", RowCell.intiRow(2, 4), ColumnCell.intiColumn(3))
      .initTitle("贷款收回", RowCell.intiRow(2, 4), ColumnCell.intiColumn(4))
      .initTitle("业务明细", RowCell.intiRow(2), ColumnCell.intiColumn(5, 14))
      .initTitle("合同发车", RowCell.intiRow(3), ColumnCell.intiColumn(5, 7))
      .initTitle("管理费及利息", RowCell.intiRow(3), ColumnCell.intiColumn(8, 10))
      .initTitle("代付运费", RowCell.intiRow(3), ColumnCell.intiColumn(11, 13))
      .initTitle("应收", RowCell.intiRow(4), ColumnCell.intiColumn(5))
      .initTitle("实收", RowCell.intiRow(4), ColumnCell.intiColumn(6))
      .initTitle("欠款", RowCell.intiRow(4), ColumnCell.intiColumn(7))
      .initTitle("应收", RowCell.intiRow(4), ColumnCell.intiColumn(8))
      .initTitle("实收", RowCell.intiRow(4), ColumnCell.intiColumn(9))
      .initTitle("欠款", RowCell.intiRow(4), ColumnCell.intiColumn(10))
      .initTitle("应收", RowCell.intiRow(4), ColumnCell.intiColumn(11))
      .initTitle("实收", RowCell.intiRow(4), ColumnCell.intiColumn(12))
      .initTitle("欠款", RowCell.intiRow(4), ColumnCell.intiColumn(13))
      .initTitle("预付款", RowCell.intiRow(3, 4), ColumnCell.intiColumn(14))
      .initTitle("新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款新增欠款", RowCell.intiRow(2, 4), ColumnCell.intiColumn(15))
      .initTitle("收款合计", RowCell.intiRow(2, 4), ColumnCell.intiColumn(16));

    workBook.initWorkBook(workBook.getWorkbook(), excellCellBasics);
    return workBook;
  }

  @Override
  public void setExcellContent(ExcellSheetBasic<String> excellSheetBasic) {

    ExcellCellBasics<String> excellCellBasics = excellSheetBasic.getExcellCellBasics();
    Integer maxRowSize = excellCellBasics.getMaxRowSize();
    for (int i = 0; i < 10; i++) {
      excellCellBasics.initContent("mhyx"+i,maxRowSize+i+1,1)
        .initContent("发车"+i,maxRowSize+i+1,2)
        .initContent("100元"+i,maxRowSize+i+1,3)
        .initContent("2022/12/21",+maxRowSize+i+1,4)
        .initContent("99元"+i,+maxRowSize+i+1,5)
        .initContent("89元"+i,+maxRowSize+i+1,6)
        .initContent("1元"+i,+maxRowSize+i+1,7)
        .initContent("99元"+i,+maxRowSize+i+1,8)
        .initContent("89元"+i,+maxRowSize+i+1,9)
        .initContent("1元"+i,+maxRowSize+i+1,10)
        .initContent("99元"+i,+maxRowSize+i+1,11)
        .initContent("89元"+i,+maxRowSize+i+1,12)
        .initContent("1元"+i,+maxRowSize+i+1,13)
        .initContent("289元"+i,+maxRowSize+i+1,14)
        .initContent("999元"+i,+maxRowSize+i+1,15)
        .initContent("1999元"+i,+maxRowSize+i+1,16);

    }
  }
}
